<template>
  <data-table ref="pagingTable" :options="options" :list-query="listQuery">
    <template #filter-content>

      <el-input v-model="listQuery.params.title" placeholder="搜索题库名称" style="width: 200px;" class="filter-item" />

    </template>

    <template #data-columns>

      <el-table-column label="题库名称">

        <template slot-scope="data">

          <router-link :to="{ name: 'UpdateRepo', params: { id: data.row.id } }">
            {{ data.row.title }}
          </router-link>

        </template>

      </el-table-column>

      <el-table-column label="单选题数量" prop="radioCount" align="center" />

      <el-table-column label="多选题数量" prop="multiCount" align="center" />

      <el-table-column label="判断题数量" prop="judgeCount" align="center" />

      <el-table-column label="创建时间" align="center" prop="createTime" />

      <el-table-column label="状态" align="center">
        <template v-slot="scope">
          <span v-if=scope.row.openType>
            所有人可见
          </span>
          <span v-else>
            仅自己可见
          </span>

        </template>
      </el-table-column>


    </template>

  </data-table>
</template>

<script>
import DataTable from '@/components/DataTable'

export default {
  name: 'QuList',
  components: { DataTable },
  data() {
    return {

      listQuery: {

        params: {
          currentPage: 1,
          size: 10,
          userId: this.$store.state.user.userId
        }
      },

      options: {

        // 可批量操作
        multi: true,

        // 批量操作列表
        multiActions: [
          {
            value: 'delete',
            label: '删除'
          }
        ],
        // 列表请求URL
        listUrl: '/repo/repoPage',
        // TODO删除请求URL
        deleteUrl: '/exam/api/repo/delete',
        // TODO启用禁用
        stateUrl: '/qu/repo/state',
        // 添加数据路由
        addRoute: 'AddRepo'
      }
    }
  },
  methods: {

  }
}
</script>
